
using System;
using System.Configuration;
using System.Data;
using System.Data.Common;
using System.Data.SqlClient;
using System.Data.Odbc;
using System.Data.OleDb;
using System.Data.SqlTypes;
using System.Collections.Generic;
using System.Linq;
using System.Text;
/*
 * This class handles connections to DBs
 * We can create various connection object for various types of database
 * 
 * */

namespace BaHuan.DataLayer
{
	public class DataConnection
	{
		public static string ConnectionString { get; set; }
		private static SqlConnection sqlConObj = null;
		private static OleDbConnection oleDbConObj = null;
		private static OdbcConnection odbcConObj = null;

		// Make sure that ONLY ONE connection at a time
		public static SqlConnection GetSqlConnection()
		{
			if (sqlConObj == null)
			{
				ConnectionString = ConfigurationManager.ConnectionStrings["SqlConStr"].ConnectionString;
				sqlConObj = new SqlConnection(ConnectionString);
			}
			return sqlConObj;
		}

		// temporary used
		public static OleDbConnection GetOleDbConnection()
		{
			return oleDbConObj;
		}

		// temporary used
		public static OdbcConnection GetOdbcConnection()
		{
			return odbcConObj;
		}
	}
}
